<template>
  <div class="common-container" :style="!cardflag ? 'background: none;' : ''">
    <div class="header">
      <div class="header_left">
        <el-input
          v-model="searchForm.imei"
          clearable
          @clear="clearImei"
          placeholder="请输入设备编码"
          size="small"
          v-if="cardflag"
          style="width: 220px; margin-right: 15px"
          maxlength="50"
          oninput="value=value.replace(/[\u4e00-\u9fa5]/g,'')"
        >
          <el-button
            slot="append"
            :icon="loadingSearch ? 'el-icon-loading' : 'el-icon-search'"
            @click="searchClick"
          >
          </el-button>
        </el-input>

        <el-popover
          placement="bottom"
          width="460"
          trigger="click"
          popper-class="popover"
          size="small"
          v-model="showPopover"
          v-if="cardflag"
        >
          <div>
            <el-form
              label-width="70px"
              style="margin: 20px 0"
              class="popover_from"
            >
              <el-row
                v-if="
                  user.roleName === 'TENANT_ADMIN' ||
                  user.roleName === 'ORG_ADMIN'
                "
              >
                <el-col :span="24">
                  <el-form-item size="small" label="组织机构">
                    <TreeSearch
                      style="width: 360px; margin-left: 15px"
                      @changeOrgId="changeOrgId"
                      @onClear="onClear"
                      ref="refTreeSearch"
                    >
                    </TreeSearch>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-form-item size="small" label="联网单位">
                <el-select
                  size="small"
                  style="width: 360px; margin-left: 15px"
                  clearable
                  v-loadMore="loadMore"
                  @change="changeunitId"
                  v-model="selectedValue"
                  placeholder="请选择联网单位"
                  filterable
                  remote
                  :remote-method="remoteMethod"
                  @clear="handleClear"
                >
                  <el-option
                    v-for="item in orgList"
                    :label="item.orgName"
                    :value="item.id"
                    :key="item.id"
                  >
                  </el-option>
                  <div
                    class="div_box"
                    v-loading="loading"
                    :style="loading ? '' : 'display: none;'"
                  ></div>
                </el-select>
              </el-form-item>
              <el-row>
                <el-col :span="24">
                  <el-form-item size="small" label="建筑物">
                    <el-select
                      size="small"
                      style="width: 360px; margin-left: 15px"
                      clearable
                      @change="changeBuildings"
                      @keyup.enter.native="searchList"
                      v-loadMore="loadBuildings"
                      v-model="buildingsName"
                      placeholder="请选择建筑物"
                      filterable
                      remote
                      :remote-method="remoteBuildings"
                      @clear="clearBuildings"
                    >
                      <el-option
                        v-for="item in buildings"
                        :label="item.name"
                        :value="item.id"
                        :key="item.id"
                      >
                      </el-option>
                      <div
                        class="div_box"
                        v-loading="loading2"
                        :style="loading2 ? '' : 'display: none;'"
                      ></div>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="12">
                  <el-form-item size="small" label="设备状态">
                    <el-select
                      v-model="searchForm.online"
                      placeholder="在离线状态"
                      size="small"
                      clearable
                      style="width: 130px; margin-left: 15px"
                    >
                      <el-option
                        v-for="item in onLineList"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item size="small" label="告警状态">
                    <el-select
                      v-model="searchForm.isAlarm"
                      placeholder="告警状态"
                      size="small"
                      clearable
                      style="width: 130px; margin-left: 15px"
                    >
                      <el-option
                        v-for="item in isAlarmList"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row>
                <el-col :span="12">
                  <el-form-item size="small" label="产品类型">
                    <el-select
                      v-model="searchForm.productId"
                      placeholder="产品类型"
                      size="small"
                      clearable
                      style="width: 130px; margin-left: 15px"
                      @visible-change="enterprise"
                      @change="ProductModelPage"
                    >
                      <el-option
                        v-for="item in productList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item size="small" label="产品型号">
                    <el-select
                      size="small"
                      style="width: 130px; margin-left: 15px"
                      v-model="searchForm.classMark"
                      placeholder="产品型号"
                      clearable
                    >
                      <el-option
                        v-for="item in classMarkList"
                        :label="item.model"
                        :value="item.model"
                        :key="item.id"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-form-item size="small" label="电量值">
                <el-input
                  type="input"
                  maxlength="3"
                  v-model.trim="searchForm.minBattery"
                  style="width: 130px; margin-left: 15px; margin-right: 8.1%"
                  placeholder="最小值"
                  oninput=" { value=value.replace(/[^\d]/g, '') } { value=value.replace(/\-{2,}/g, '-') } { value=value.replace(/(\d)\-/g, '$1') }
                { value=value.replace(/-(0+)/g, '0') } { value=value.replace(/^0+(\d)/, '$1') }
                  {if(value>100)value=100}"
                >
                </el-input>
                ——
                <el-input
                  type="input"
                  maxlength="3"
                  v-model.trim="searchForm.maxBattery"
                  style="width: 130px; margin-left: 8.1%"
                  placeholder="最大值"
                  oninput=" { value=value.replace(/[^\d]/g, '') } { value=value.replace(/\-{2,}/g, '-') } { value=value.replace(/(\d)\-/g, '$1') }
                { value=value.replace(/-(0+)/g, '0') } { value=value.replace(/^0+(\d)/, '$1') }
                  {if(value>100)value=100}"
                >
                </el-input>
              </el-form-item>

              <el-row>
                <el-col :span="12">
                  <el-form-item size="small" label="到期状态">
                    <el-select
                      v-model="searchForm.validity"
                      placeholder="到期状态"
                      size="small"
                      clearable
                      style="margin-left: 15px; width: 130px"
                    >
                      <el-option
                        v-for="item in validityList"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item size="small" label="安装备注">
                    <el-input
                      type="input"
                      maxlength="10"
                      v-model.trim="searchForm.remark"
                      style="width: 130px; margin-left: 15px"
                      placeholder="安装备注"
                    >
                    </el-input>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-form-item size="small" label="安装时间">
                <el-date-picker
                  v-model.trim="timeArr"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始时间"
                  end-placeholder="结束时间"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  :default-time="['00:00:00', '23:59:59']"
                  :picker-options="pickerOptions"
                  style="width: 360px"
                  clearable
                >
                </el-date-picker>
              </el-form-item>
            </el-form>
            <div class="footer" style="text-align: right">
              <el-button size="small" @click="resetClick" class="cancel-button"
                >重 置</el-button
              >
              <el-button
                size="small"
                @click="searchClick1"
                class="confirm-button"
                >确 定</el-button
              >
            </div>
          </div>
          <el-button
            size="small"
            slot="reference"
            :class="hasSearch ? 'elhasSearch elhasSearch2' : 'elhasSearch2'"
          >
            高级搜索<i
              class="el-icon-search"
              style="margin-left: 5px; font-size: 12px"
            ></i
          ></el-button>
        </el-popover>
      </div>
      <div class="header_right">
        <div class="div_qiehuan">
          <div
            class="kapian"
            @click="switchover(false)"
            :style="!cardflag ? 'background: #7367F0' : ''"
          >
            <i
              class="iconfont dasuolvetuliebiao"
              :style="!cardflag ? 'color: #fff;' : ''"
            ></i>
            <span :style="!cardflag ? 'color: #fff;' : ''">卡片</span>
          </div>
          <div
            class="lieBiao"
            @click="switchover(true)"
            :style="cardflag ? 'background: #7367F0' : ''"
          >
            <i
              class="iconfont liebiao"
              :style="cardflag ? 'color: #fff;' : ''"
            ></i>
            <span :style="cardflag ? 'color: #fff;' : ''">列表</span>
          </div>
        </div>

        <el-button
          size="small"
          class="el_button"
          icon="el-icon-plus"
          @click="addClick"
          style="margin-left: 20px"
          v-permission="{ action: 'device:add' }"
          v-if="cardflag"
          >绑定</el-button
        >

        <el-button
          class="el_button"
          size="small"
          icon="el-icon-upload2"
          style="margin-left: 15px"
          @click="onExports"
          v-permission="{ action: 'device:export' }"
          v-if="cardflag"
        >
          导出
        </el-button>

        <!-- <el-button class="el_button" size="small" icon="el-icon-position" style="margin-left: 15px" @click="ClickIssued" :disabled="flagIssued" v-if="cardflag">
          批量下发指令
        </el-button> -->

        <el-dropdown @command="onDropdown" v-if="cardflag">
          <el-button class="el_button" size="small" style="margin-left: 15px">
            批量操作<i class="el-icon-arrow-down el-icon--right"></i>
          </el-button>
          <el-dropdown-menu slot="dropdown">
            <!-- <el-dropdown-item command="Issued" :disabled="flagIssued">批量下发</el-dropdown-item> -->
            <el-dropdown-item command="alarm" :disabled="flagalarm"
              >告警模式</el-dropdown-item
            >
            <el-dropdown-item command="deadline">有效期限</el-dropdown-item>
            <el-dropdown-item command="InstallationRemarks"
              >安装备注</el-dropdown-item
            >
          </el-dropdown-menu>
        </el-dropdown>

        <!-- <el-button
          size="medium"
          icon="el-icon-delete"
          style="margin-left: 15px"
          @click="batchDelClick"
        >
          批量解绑
        </el-button> -->
      </div>
    </div>
    <div
      class="content"
      v-if="cardflag"
      v-loading="loadingData"
      element-loading-spinner="el-icon-loading"
      element-loading-background="rgba(47, 51, 73, 0.3)"
      element-loading-text="拼命加载中"
    >
      <el-table
        :data="dataList"
        height="calc(100% - 65px)"
        class="table"
        ref="refTable"
        row-key="id"
        :header-cell-style="headerStyle"
        @selection-change="batchSelect"
      >
        <el-table-column
          align="center"
          type="selection"
          :reserve-selection="true"
          width="45"
        ></el-table-column>
        <el-table-column
          align="center"
          label="序号"
          type="index"
          width="50"
          v-if="headerList[0].flag"
        >
        </el-table-column>
        <el-table-column
          align="center"
          prop="imei"
          label="设备编码"
          min-width="140"
          show-overflow-tooltip
          v-if="headerList[1].flag"
        >
        </el-table-column>
        <el-table-column
          align="center"
          prop="spaceName"
          label="安装点"
          min-width="180"
          style="word-wrap: break-word"
          v-if="headerList[2].flag"
        >
        </el-table-column>

        <el-table-column
          align="center"
          prop="online"
          label="位置标记"
          min-width="90"
          v-if="headerList[3].flag"
        >
          <template slot-scope="scope">
            <i
              class="el-icon-success"
              v-if="scope.row.mark != ''"
              style="color: #28c76f; cursor: pointer"
              @click="updateMark(scope.row)"
            ></i>
            <i
              class="el-icon-error"
              v-else
              style="color: #f84242; cursor: pointer"
              @click="updateMark(scope.row)"
            ></i>
          </template>
        </el-table-column>

        <el-table-column
          align="center"
          prop="online"
          label="设备状态"
          min-width="90"
          v-if="headerList[4].flag"
        >
          <template slot-scope="scope">
            <span v-if="scope.row.deviceType == 'Camera'">-</span>
            <el-tag
              type="success"
              size="mini"
              v-else-if="scope.row.online === 1"
              >在线</el-tag
            >
            <el-tag type="danger" size="mini" v-else>离线</el-tag>
          </template>
        </el-table-column>

        <el-table-column
          align="center"
          prop="isAlarm"
          label="告警状态"
          min-width="90"
          v-if="headerList[5].flag"
        >
          <template slot-scope="scope">
            <span v-if="scope.row.deviceType == 'Camera'">-</span>
            <el-tag
              type="success"
              size="mini"
              v-else-if="scope.row.isAlarm === 0"
              >正常</el-tag
            >
            <el-tag type="danger" size="mini" v-else>告警</el-tag>
          </template>
        </el-table-column>

        <el-table-column
          align="center"
          prop="batteryValue"
          label="电量"
          min-width="90"
          show-overflow-tooltip
          v-if="headerList[6].flag"
        >
          <template slot-scope="{ row }">
            <span
              v-if="
                row.batteryValue === '' ||
                row.batteryValue == null ||
                row.classMark == 'V380'
              "
              >-</span
            >
            <el-tag
              type="success"
              size="mini"
              v-else-if="row.batteryValue >= 30"
              >{{ row.batteryValue }}</el-tag
            >
            <el-tag type="danger" size="mini" v-else>{{
              row.batteryValue
            }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="signalValue"
          label="信号"
          min-width="90"
          show-overflow-tooltip
          v-if="headerList[7].flag"
        >
          <template slot-scope="{ row }">
            <el-tag type="success" size="mini" v-if="row.signalValue == 0"
              >优</el-tag
            >
            <el-tag type="warning" size="mini" v-else-if="row.signalValue == 1"
              >良</el-tag
            >
            <el-tag type="danger" size="mini" v-else-if="row.signalValue == 2"
              >差</el-tag
            >
            <span v-else-if="row.signalValue == '' || row.signalValue == null"
              >-</span
            >
            <el-tag type="danger" size="mini" v-else>差</el-tag>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="name"
          label="产品类型"
          min-width="140"
          show-overflow-tooltip
          v-if="headerList[8].flag"
        >
        </el-table-column>
        <el-table-column
          align="center"
          prop="classMark"
          label="产品型号"
          min-width="140"
          show-overflow-tooltip
          v-if="headerList[9].flag"
        >
        </el-table-column>
        <el-table-column
          align="center"
          prop="orgName"
          label="联网单位"
          min-width="160"
          show-overflow-tooltip
          v-if="headerList[10].flag"
        >
        </el-table-column>
        <el-table-column
          align="center"
          prop="isDefence"
          min-width="140"
          label="布防状态"
          show-overflow-tooltip
          v-if="headerList[11].flag"
        >
          <template slot-scope="scope">
            <el-tag v-if="scope.row.isDefence == 0" type="warning"
              >已撤防</el-tag
            >
            <el-tag v-else type="success">已布防</el-tag>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="installTime"
          label="安装时间"
          min-width="160"
          show-overflow-tooltip
          v-if="headerList[12].flag"
        >
        </el-table-column>
        <el-table-column
          align="center"
          prop="validity"
          label="到期状态"
          min-width="120"
          show-overflow-tooltip
          v-if="headerList[13].flag"
        >
          <template slot-scope="scope">
            <el-tag type="success" size="mini" v-if="scope.row.validity === 0"
              >未到期</el-tag
            >
            <el-tag type="danger" size="mini" v-else>已到期</el-tag>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="inDate"
          label="有效期限（月）"
          min-width="120"
          show-overflow-tooltip
          v-if="headerList[14].flag"
        >
          <template slot-scope="scope">
            <el-tag type="success" size="mini" v-if="scope.row.inDate == 0"
              >无期限</el-tag
            >
            <el-tag type="danger" size="mini" v-else>{{
              scope.row.inDate
            }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="validityTime"
          label="到期时间"
          min-width="160"
          show-overflow-tooltip
          v-if="headerList[15].flag"
        >
        </el-table-column>
        <el-table-column
          align="center"
          prop="remark"
          label="安装备注"
          min-width="100"
          show-overflow-tooltip
          v-if="headerList[16].flag"
        >
        </el-table-column>
        <el-table-column
          align="center"
          prop="management"
          label="操作"
          width="220"
          fixed="right"
        >
          <template slot="header">
            <div
              style="
                display: flex;
                align-items: center;
                justify-content: center;
              "
            >
              <div>操作</div>
              <el-tooltip
                class="item"
                effect="dark"
                content="表头设置"
                placement="bottom"
              >
                <i
                  @click.stop="Show"
                  class="el-icon-setting"
                  style="
                    font-size: 16px;
                    margin-left: 10px;
                    margin-bottom: 2px;
                    cursor: pointer;
                  "
                ></i>
              </el-tooltip>
            </div>
          </template>

          <template slot-scope="{ row }">
            <el-tooltip
              class="item"
              effect="dark"
              content="撤防时段"
              placement="bottom"
              v-permission="{ action: 'device:time' }"
            >
              <i
                @click="timeClick(row)"
                class="iconfont shijian tableBtnIcon"
              ></i>
            </el-tooltip>
            <el-tooltip
              class="item"
              effect="dark"
              content="下发指令"
              placement="bottom"
              v-permission="{ action: 'device:command' }"
              v-if="
                row.deviceType !== 'UserTransferDevice' &&
                row.deviceType !== 'FireAlarmController'
              "
            >
              <i
                @click="instructionsClick(row)"
                class="el-icon-position tableBtnIcon"
              ></i>
            </el-tooltip>
            <el-tooltip
              class="item"
              effect="dark"
              content="子设备"
              placement="bottom"
              v-permission="{ action: 'device:child' }"
              v-if="row.classMark === 'LK-SGBJ-01'"
            >
              <i
                @click="addChildDeviceClick(row)"
                class="iconfont chakanfuzishebei tableBtnIcon"
              ></i>
            </el-tooltip>
            <el-tooltip
              class="item"
              effect="dark"
              content="编辑"
              placement="bottom"
              v-permission="{ action: 'device:edit' }"
              v-if="row.deviceType === 'DoorMagnetism'"
            >
              <i
                @click="editClick(row)"
                class="iconfont tianxie tableBtnIcon"
              ></i>
            </el-tooltip>
            <!-- v-if="row.deviceType === 'Camera' || row.deviceType === 'DoorMagnetism' || row.deviceType === 'Infrared' || row.deviceType === 'GasSensor' || row.deviceType === 'SmokeAlarm' || row.deviceType === 'FireHydrant' || row.deviceType === 'WaterSensor'" -->
            <el-tooltip
              class="item"
              effect="dark"
              content="详情"
              placement="bottom"
              v-permission="{ action: 'device:details' }"
            >
              <i
                @click="doorLogClick(row)"
                class="el-icon-tickets tableBtnIcon"
              ></i>
            </el-tooltip>
            <el-tooltip
              class="item"
              effect="dark"
              content="拆除"
              placement="bottom"
              v-permission="{ action: 'device:delete' }"
            >
              <i
                @click="delClick(row)"
                class="iconfont shanchu tableBtnIcon"
              ></i>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>

      <div class="biaotou_div" v-if="show" @click.stop>
        <div class="biaotou_headr">
          表头设置
          <i class="el-icon-close biaotou_headr_i" @click="show = false"></i>
        </div>
        <div style="overflow: auto; height: 351px">
          <template>
            <div
              class="biaotou_neiron"
              v-for="(item, index) in headerList"
              :key="index"
            >
              {{ item.name }}
              <el-switch
                slot="reference"
                v-model="item.flag"
                active-color="#7367F0"
                @click.stop="ShowHidden(item, index)"
                @change="onChange"
                :disabled="item.name == '设备编码'"
              >
              </el-switch>
            </div>
          </template>
        </div>
      </div>

      <pagination
        :page.sync="page"
        :limit.sync="limit"
        :total="total"
        @pagination="getDataList"
        class="pagination"
      >
      </pagination>
    </div>

    <!-- 卡片 -->
    <cardList v-else @deviceClick="deviceClick"></cardList>

    <device-add ref="refAdd" :targetId="targetId"></device-add>
    <import-device ref="showImportDevice"></import-device>
    <door-log ref="refDoorLog" :deviceInfo="deviceInfo"></door-log>
    <Instructions
      ref="refInstructions"
      :idList="idList"
      :deviceInfo="deviceInfo"
    ></Instructions>
    <InstructionList
      ref="refInstructionList"
      :deviceInfo="deviceInfo"
      :identifier="identifier"
      :serviceType="serviceType"
      :serviceValue="serviceValue"
    ></InstructionList>
    <editDevice
      ref="refeditDevice"
      :deviceInfo="deviceInfo"
      :idList="idList"
    ></editDevice>
    <particulars ref="refparticulars" :deviceInfo="deviceInfo"></particulars>
    <Ichnography ref="refIchnography" :editInfo="editInfo"></Ichnography>
    <editTime ref="refeditTime" :deviceInfo="deviceInfo"></editTime>
    <batchDeadline ref="refbatchDeadline" :idList="idList"></batchDeadline>
    <InstallationRemarks
      ref="refInstallationRemarks"
      :idList="idList"
    ></InstallationRemarks>
    <ChildDevice ref="refChildDevice" :deviceInfo="deviceInfo" />
  </div>
</template>

<script>
import {
  reqDeviceList,
  reqProductList,
  reqDeviceUnBind,
  reqBatchCommand,
  reqFloorById,
  reqDeviceTask,
  reqCommandServicePage,
  reqDeviceUnBindByFather,
} from "@api/api.js";
import tableStyleMixin from "@mixin/table-style";
import Pagination from "@components/Pagination.vue";
import ImportDevice from "./components/ImportDevice.vue";
import DeviceAdd from "./components/DeviceAdd.vue";
import Instructions from "./components/Instructions.vue";
import InstructionList from "./components/InstructionList.vue";
import ChildDevice from "./components/childDevice/List.vue";
import { mapState } from "vuex";
import DoorLog from "./components/DoorLog.vue";
// import batchDel from "@views/mixins/batchDel.js";
import loadMore from "@mixin/loadMore";
import cardList from "./cardList.vue";
import editDevice from "./components/editDevice.vue";
import particulars from "@components/DeviceInfo/particulars.vue"; //设备详情组件
import advanceSearchMixin from "./mixins/advanceSearch.js";
import Ichnography from "./components/Ichnography.vue";
import editTime from "./components/editTime.vue";
import batchDeadline from "./components/batchDeadline.vue";
import InstallationRemarks from "./components/InstallationRemarks.vue";
import TreeSearch from "@components/TreeSearch.vue";

export default {
  name: "device",
  components: {
    Pagination,
    ImportDevice,
    DeviceAdd,
    DoorLog,
    cardList,
    Instructions,
    InstructionList,
    editDevice,
    particulars,
    Ichnography,
    editTime,
    batchDeadline,
    InstallationRemarks,
    TreeSearch,
    ChildDevice,
  },
  mixins: [tableStyleMixin, loadMore, advanceSearchMixin],
  data() {
    return {
      page: 1,
      limit: 10,
      total: 0,
      dataList: [],
      searchForm: {
        online: "",
        productId: "",
        imei: "",
        orgId: "",
        minBattery: "",
        maxBattery: "",
        isAlarm: "",
        buildingId: "",
        validity: "",
        classMark: "",
        remark: "",
      },
      showPopover: false, //v-model默认值是false, click激活变成true
      orgList: [],
      loadingSearch: false,
      onLineList: [
        {
          value: 1,
          label: "在线",
        },
        {
          value: 0,
          label: "离线",
        },
      ],
      isAlarmList: [
        {
          value: "0",
          label: "正常",
        },
        {
          value: 1,
          label: "告警",
        },
      ],
      validityList: [
        {
          value: 0,
          label: "未到期",
        },
        {
          value: 1,
          label: "已到期",
        },
      ],
      deviceInfo: {}, //设备一条信息
      productList: [],
      batchDataList: [], //批量操作勾选的数据
      sysInstanceIndex: 1,
      sysInstanceTotalPages: 10,
      flag: true,
      loading: false,
      cardflag: false,
      loadingData: false,
      flagIssued: true,
      flagalarm: true, //告警模式禁用
      idList: [],
      editInfo: {},
      ProductList: [],
      show: false, //表头设置默认隐藏
      headerList: [
        {
          name: "序号",
          flag: true,
        },
        {
          name: "设备编码",
          flag: true,
        },
        {
          name: "安装点",
          flag: true,
        },
        {
          name: "位置标记",
          flag: true,
        },
        {
          name: "设备状态",
          flag: true,
        },
        {
          name: "告警状态",
          flag: true,
        },
        {
          name: "电量",
          flag: true,
        },
        {
          name: "信号",
          flag: true,
        },
        {
          name: "产品类型",
          flag: true,
        },
        {
          name: "产品型号",
          flag: true,
        },
        {
          name: "联网单位",
          flag: true,
        },
        {
          name: "布防状态",
          flag: true,
        },
        {
          name: "安装时间",
          flag: false,
        },
        {
          name: "到期状态",
          flag: false,
        },
        {
          name: "有效期限（月）",
          flag: false,
        },
        {
          name: "到期时间",
          flag: false,
        },
        {
          name: "安装备注",
          flag: false,
        },
      ],
      // 导出加筛选条件
      exportList: {
        imei: "",
        online: "",
        productId: "",
        orgId: "",
        minBattery: "",
        maxBattery: "",
        isAlarm: "",
        buildingId: "",
        validity: "",
        classMark: "",
        startTime: "",
        endTime: "",
        remark: "",
      },
      meterList: [],
      identifier: "",
      serviceType: "",
      serviceValue: "",
      targetId: "",
      organParams: {},
      first: false,
      parentId: "",
    };
  },
  watch: {
    // headerList(val) {
    //   // console.log(111);
    //   // this.$nextTick(() => {
    //   //   this.$refs.refTable.doLayout()
    //   // })
    // }
  },
  computed: {
    ...mapState(["user", "spacesManage"]),
  },
  mounted() {
    document.addEventListener("click", this.handleClickOutside);
    this.targetId = this.spacesManage.organizationInfo.orgId;
    this.getDataList();
    this.searchForm.buildingId = ""; // 清空建筑物
    this.clearBuildings(); //建筑物
    // if (
    //   this.user.roleName == "ORG_ADMIN" ||
    //   this.user.roleName == "INSTERALL_USER"
    // ) {
    //   // 组织||装维
    //   this.targetId = this.spacesManage.organizationInfo.orgId;
    //   this.getDataList();
    //   this.searchForm.buildingId = ""; // 清空建筑物
    //   this.clearBuildings(); //建筑物
    // } else {
    //   this.targetId = this.spacesManage.organizationInfo.orgId;
    //   this.getDataList();
    //   this.searchForm.buildingId = ""; // 清空建筑物
    //   this.clearBuildings(); //建筑物
    // }
  },
  // 避免内存泄漏
  beforeDestroy() {
    document.removeEventListener("click", this.handleClickOutside);
  },
  methods: {
    onClear() {
      // this.targetId = this.spacesManage.organizationInfo.orgId;
      // this.page = 1;
      // this.limit = 10;
      // this.searchForm.buildingId = ""; // 清空建筑物
      // this.clearBuildings(); //建筑物
    },
    // 组织机构筛选
    // toggleOrgId(data,flagdata) {
    //   // console.log(data,'data');
    //   // console.log(flagdata)
    //   if(flagdata) return;
    //   this.organParams = data
    //   this.targetId = data.orgId || ''
    // },
    handleClickOutside(event) {
      // 判断点击是否在表头设置区域内
      const biaotouDiv = this.$el.querySelector(".biaotou_div");
      const elIconSetting = this.$el.querySelector(".el-icon-setting");
      if (
        (!biaotouDiv || !biaotouDiv.contains(event.target)) &&
        (!elIconSetting || !elIconSetting.contains(event.target))
      ) {
        this.show = false;
      }
    },
    //显隐设置
    ShowHidden(item) {
      item.flag = !item.flag;
    },
    onChange() {
      this.$nextTick(() => {
        this.$refs.refTable.doLayout(); //对 Table 进行重新布局。当 Table 或其祖先元素由隐藏切换为显示时，可能需要调用此方法
      });
      // 表头设置 :记住当前账号的设置 存储在本地浏览器
      let meterflag = true;
      this.meterList.forEach((item) => {
        if (item.id == this.user.userId) {
          meterflag = false;
          item.arr = this.headerList;
          return;
        }
      });
      if (meterflag) {
        // 本地浏览器第一次设置
        this.meterList.push({
          id: this.user.userId,
          arr: this.headerList,
        });
      }
      localStorage.setItem("meter", JSON.stringify(this.meterList));
    },
    //显隐表头
    Show() {
      this.show = !this.show;
    },
    // 修改标记点
    async updateMark(e) {
      // console.log(e,'eee');
      this.editInfo = JSON.parse(JSON.stringify(e));
      // 获取平面图 图片
      const res = await reqFloorById(e.spaceId);
      // console.log(res);
      if (res.code !== 20000) return this.$modal.notifyWarning(res.message);
      if (res.data.rows.image == "")
        return this.$modal.notifyWarning("当前楼层暂无平面图,请上传后操作!");
      this.$refs.refIchnography.getimage(res.data.rows.image);
      this.$refs.refIchnography.dialogVisible = true;
      if (e.mark != "") {
        this.$refs.refIchnography.getMark(e.mark);
      }
    },
    // 点击卡片内容切换到列表
    async deviceClick(e, index) {
      // console.log(index);
      // console.log(e);
      this.cardflag = true;
      this.loadingData = true;
      await this.getProductList();
      this.searchForm.productId = e ? e : "";
      if (index == 1) {
        this.searchForm.isAlarm = "";
        this.searchForm.online = 1;
      } else if (index == 0) {
        this.searchForm.isAlarm = "";
        this.searchForm.online = 0;
      } else if (index == 2) {
        this.searchForm.online = "";
        this.searchForm.isAlarm = 1;
      } else {
        this.searchForm.online = "";
        this.searchForm.isAlarm = "";
      }
      // if(this.user.roleName == 'ORG_ADMIN' || this.user.roleName == 'INSTERALL_USER'){
      //     // 如果是组织||装维 进来不默认选中第一个组织机构
      //     this.targetId=''
      //   }
      await this.Product(); //产品列表
      await this.ProductModelPage(e);
      // await this.getDataList();
      await this.getInitDataList()
      this.loadingData = false;
    },
    // 卡片切换
    async switchover(val) {
      this.cardflag = val;
      if (val) {
        this.loadingData = true;
        this.page = 1;
        this.limit = 10;
        this.searchForm = {
          online: "",
          productId: "",
          imei: "",
          orgId: "",
          minBattery: "",
          maxBattery: "",
          isAlarm: "",
          buildingId: "",
          validity: "",
          classMark: "",
        };
        this.dataList = [];
        this.total = 0;
        await this.Product(); //产品列表
        // if(this.user.roleName == 'ORG_ADMIN' || this.user.roleName == 'INSTERALL_USER'){
        //   // 组织||装维 进来不默认选中第一个组织机构
        //   this.targetId=''
        // }
        await this.getDataList();
        this.loadingData = false;
      }
    },
    enterprise(val) {
      if (val) {
        this.getProductList();
      }
    },
    // 更多操作回调事件
    async onDropdown(e) {
      // if (this.batchDataList.length <= 0) {
      //   this.$modal.notifyWarning("请勾选要操作的建筑物");
      //   return;
      // }
      let idList = [];
      switch (e) {
        case "Issued":
          if (this.batchDataList.length <= 0)
            return this.$modal.notifyWarning("请先勾选需要下发指令的设备");
          idList = this.batchDataList.map((item) => {
            return item.id;
          });
          // console.log(idList);
          this.deviceInfo = JSON.parse(JSON.stringify(this.batchDataList[0]));
          this.idList = JSON.parse(JSON.stringify(idList));
          this.$refs.refInstructions.dialogVisible = true;
          break;
        case "alarm":
          idList = this.batchDataList.map((item) => {
            return item.id;
          });
          // console.log(idList);
          // this.deviceInfo = JSON.parse(JSON.stringify(this.batchDataList[0]));
          this.idList = JSON.parse(JSON.stringify(idList));
          this.$refs.refeditDevice.dialogVisible = true;
          break;
        case "deadline":
          if (this.batchDataList.length <= 0)
            return this.$modal.notifyWarning("请先勾选设备");
          idList = this.batchDataList.map((item) => {
            return item.id;
          });
          this.idList = JSON.parse(JSON.stringify(idList));
          this.$refs.refbatchDeadline.dialogVisible = true;
          break;
        case "InstallationRemarks":
          if (this.batchDataList.length <= 0)
            return this.$modal.notifyWarning("请先勾选设备");
          idList = this.batchDataList.map((item) => {
            return item.id;
          });
          this.idList = JSON.parse(JSON.stringify(idList));
          this.$refs.refInstallationRemarks.dialogVisible = true;
          break;
      }
    },
    // 添加子设备
    addChildDeviceClick(row) {
      this.deviceInfo = JSON.parse(JSON.stringify(row));
      this.$refs.refChildDevice.dialogVisible = true;
    },
    // 编辑
    editClick(row) {
      this.idList = [];
      // console.log(row);
      this.deviceInfo = JSON.parse(JSON.stringify(row));
      this.$refs.refeditDevice.dialogVisible = true;
    },
    // 获取设备列表
    async getDataList() {
      if (this.timeArr == null) {
        this.timeArr = "";
      }
      let {
        imei,
        online,
        productId,
        orgId,
        minBattery,
        maxBattery,
        isAlarm,
        buildingId,
        validity,
        classMark,
        remark,
      } = this.searchForm;
      const res = await reqDeviceList(this.page, this.limit, {
        userId: this.user.userId,
        roleName: this.user.roleName,
        tenantId: this.user.tenantId,
        imei,
        online,
        productId,
        orgId: this.selectedValue == "" ? this.parentId : this.selectedValue, //机构||单位
        minBattery,
        maxBattery,
        isAlarm,
        buildingId,
        validity,
        classMark,
        startTime: this.timeArr[0],
        endTime: this.timeArr[1],
        remark,
      });
      if (res.code !== 20000) return this.$modal.notifyWarning(res.message);
      this.hasSearch =
        this.parentId ||
        this.selectedValue ||
        online ||
        productId ||
        minBattery ||
        maxBattery ||
        isAlarm ||
        buildingId ||
        validity ||
        classMark ||
        this.timeArr[0] ||
        this.timeArr[1] ||
        remark
          ? true
          : false;
      this.exportList = {
        imei,
        online,
        productId,
        orgId: this.selectedValue == "" ? this.parentId : this.selectedValue, //机构||单位
        minBattery,
        maxBattery,
        isAlarm,
        buildingId,
        validity,
        classMark,
        startTime: this.timeArr[0],
        endTime: this.timeArr[1],
        remark,
      };
      this.dataList = res.data.rows;
      this.dataList.forEach((item) => {
        this.ProductList.forEach((item2) => {
          if (item.deviceType == item2.deviceType) {
            item.name = item2.name; //产品名称
          }
        });
      });
      this.total = res.data.total;
    },
    // 产品列表
    async Product() {
      let res = await reqProductList();
      if (res.code !== 20000) return this.$modal.notifyWarning(res.message);
      this.ProductList = res.data.rows;
    },
    getInitDataList() {
      this.page = 1;
      this.limit = 10;
      this.getDataList();
      this.clearSelections(); //清除勾选的设备
    },
    // 选择在离线状态
    changeOnline() {
      this.getInitDataList();
    },
    // 选择产品类型
    changeProductId(val) {
      // console.log(val);
      this.flagIssued = true;
      // this.productList.forEach(item=>{
      //   if(item.deviceType=='Infrared' && item.id==val){
      //     this.flagIssued=false;
      //     return;
      //   }
      // })
      this.getInitDataList();
    },
    // 查询
    async searchClick() {
      this.page = 1;
      this.limit = 10;
      this.loadingSearch = true;
      await this.getDataList();
      this.loadingSearch = false;
      this.clearSelections();
    },
    //   获取产品列表
    async getProductList() {
      const res = await reqProductList();
      if (res.code !== 20000) return this.$modal.notifyWarning(res.message);
      // console.log(res);
      this.productList = res.data.rows;
    },
    // 清除请求
    clearOnline() {
      this.getInitDataList();
    },
    clearProductId() {
      this.getInitDataList();
    },
    clearImei() {
      this.getInitDataList();
    },
    // 新增
    addClick() {
      this.$refs.refAdd.dialogVisible = true;
      // this.$refs.refAdd.getBuildList();
      if (
        this.user.roleName == "INSTERALL_USER" ||
        this.user.roleName == "UNIT_ADMIN"
      ) {
        this.$refs.refAdd.getOrgList();
      }
    },
    // 导出  设备筛选有几个字段，这个接口就要加几个字段
    async onExports() {
      const result = await this.$confirm(
        "此操作将导出设备安装信息, 是否继续?",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      ).catch(() => {});
      if (result !== "confirm") return;
      const res = await reqDeviceTask({
        userId: this.user.userId,
        roleName: this.user.roleName,
        tenantId: this.user.tenantId,
        taskName: this.user.tenantName + "设备安装信息",
        imei: this.exportList.imei,
        online: this.exportList.online,
        productId: this.exportList.productId,
        orgId: this.exportList.orgId,
        minBattery: this.exportList.minBattery,
        maxBattery: this.exportList.maxBattery,
        isAlarm: this.exportList.isAlarm,
        buildingId: this.exportList.buildingId,
        validity: this.exportList.validity,
        classMark: this.exportList.classMark,
        startTime: this.exportList.startTime,
        endTime: this.exportList.endTime,
        remark: this.exportList.remark,
      });
      if (res.code !== 20000) return this.$modal.notifyWarning(res.message);
      this.$modal.notifySuccess("导出成功，请在任务管理中查看");
      this.$router.push({
        name: "exportTask",
        params: { orgId: this.selectedValue },
      });
    },

    doorLogClick(row) {
      // this.$refs.refDoorLog.dialogVisible = true;
      // this.deviceInfo = JSON.parse(JSON.stringify(row));
      // if (row.deviceMac == "" && row.deviceType == "Camera" && row.manufacturerId != '1660554046491635714' && row.classMark != 'V380')
      //   return this.$modal.notifyWarning("设备MAC地址为空");
      if (
        row.deviceType === "UserTransferDevice" ||
        row.deviceType === "FireAlarmController"
      ) {
        this.$store.commit("saveDeviceInfo", row); //保存信息，使页面刷新信息还存在
        this.$router.push("/device/host");
      } else {
        this.$refs.refparticulars.dialogVisible = true;
        this.deviceInfo = JSON.parse(JSON.stringify(row));
      }
    },

    // 指令下发
    async instructionsClick(row) {
      // console.log(row);
      this.deviceInfo = JSON.parse(JSON.stringify(row));
      // 单独判断消音下发功能
      const res = await reqCommandServicePage(1, 50, {
        productModel: this.deviceInfo.classMark,
        protocol: this.deviceInfo.protocol,
      });
      if (res.code !== 20000) return this.$modal.notifyWarning(res.message);
      console.log(res);
      if (res.data.total == 0)
        return this.$modal.notifyWarning("没有可下发的指令");
      let erasure = false;
      let dataDefinition = "";
      res.data.rows.forEach((item) => {
        if (item.serviceName == "消音下发") {
          erasure = true;
          this.identifier = item.identifier;
          this.serviceType = item.serviceType;
          dataDefinition = JSON.parse(item.dataDefinition);
        } else if (item.serviceName == "控制报警") {
          erasure = true;
          this.identifier = item.identifier;
          this.serviceType = item.serviceType;
        }
      });
      if (!erasure) return this.$modal.notifyWarning("没有可下发的指令");
      if (dataDefinition && dataDefinition.length) {
        dataDefinition.forEach((item) => {
          if (item.key == "消音") {
            this.serviceValue = item.value; //指令值
          }
        });
      }

      this.$refs.refInstructionList.dialogVisible = true;
    },
    timeClick(row) {
      // console.log(row);
      this.deviceInfo = JSON.parse(JSON.stringify(row));
      this.$refs.refeditTime.dialogVisible = true;
    },
    // 批量下发指令
    //  async ClickIssued(){
    //     let { batchDataList } = this;
    //     if (batchDataList.length <= 0)
    //       return this.$modal.notifyWarning("请先勾选需要下发指令的设备");
    //       let idList = batchDataList.map((item) => {
    //       return item.id;
    //     });
    //     this.deviceInfo = JSON.parse(JSON.stringify(this.batchDataList[0]));
    //     this.idList = JSON.parse(JSON.stringify(idList));
    //     this.$refs.refInstructions.dialogVisible=true;
    //   },
    // 解绑
    async delClick(row) {
      const result = await this.$confirm(
        "此操作将拆除该设备, 是否继续?",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      ).catch(() => {});
      if (result !== "confirm") return;
      this.reqDelFun(row);
    },
    // 点击复选框触发，可跨分页选择
    batchSelect(arr) {
      // console.log(arr);
      let type = "";
      arr.forEach((item, index) => {
        // console.log(item,index);
        if (index == 0) {
          type = item.deviceType; //判断是不是同一种类型
        }
        //先判断是不是同一种类型
        if (item.deviceType != type) {
          // console.log(111);
          this.flagIssued = true;
          return;
        } else {
          if (
            item.deviceType == "Infrared" ||
            item.deviceType == "SmokeAlarm"
          ) {
            // console.log(222);
            this.flagIssued = false;
          } else {
            this.flagIssued = true;
          }
          if (item.deviceType == "DoorMagnetism") {
            this.flagalarm = false;
          } else {
            this.flagalarm = true;
          }
        }
      });
      this.batchDataList = arr;
    },
    // 批量解绑
    async batchDelClick() {
      let { batchDataList } = this;
      if (batchDataList.length <= 0)
        return this.$modal.notifyWarning("请先勾选需要拆除的设备");
      const result = await this.$confirm(
        "此操作将永久拆除勾选的设备, 是否继续?",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      ).catch(() => {});
      if (result !== "confirm") return;
      // const res = await reqBatchCommand({ idList });
      // if (res.code !== 20000) return this.$modal.notifyWarning(res.message);
      // this.$modal.notifySuccess("批量下发指令成功！");
      // this.getInitDataList();
    },
    // 清空复选框√√
    clearSelections() {
      this.flagalarm = true;
      this.flagIssued = true;
      this.$refs.refTable.clearSelection();
    },
    // 请求解绑
    async reqDelFun(row) {
      if (row.classMark === "LK-SGBJ-01") {
        // 电气设备（需下发指令）
        const res = await reqDeviceUnBindByFather({
          id: row.id,
          userId: this.user.userId,
        });
        if (res.code !== 20000) return this.$modal.notifyWarning(res.message);
      } else {
        // 其他设备
        const res = await reqDeviceUnBind({
          id: row.id,
          userId: this.user.userId,
        });
        if (res.code !== 20000) return this.$modal.notifyWarning(res.message);
      }
      this.$modal.notifySuccess("拆除成功");
      this.getInitDataList();
    },
    // 导入
    importClick() {},
  },
  async created() {
    if (
      this.user.roleName == "ORG_ADMIN" ||
      this.user.roleName == "INSTERALL_USER"
    ) {
      // 组织||装维 进来不默认选中第一个组织机构
      this.first = false;
    } else {
      this.first = true;
    }
    // console.log(this.$route.params);
    if (localStorage.getItem("meter")) {
      // 表头设置 :记住当前账号的设置 存储在本地浏览器
      this.meterList = JSON.parse(localStorage.getItem("meter") || []);
      this.meterList.forEach((item) => {
        if (item.id == this.user.userId) {
          this.headerList = item.arr;
          return;
        }
      });
    }
    if (this.$route.params.orgId) {
      this.cardflag = true;
      if (this.$route.params.orgId != "1") {
        this.selectedValue = this.$route.params.orgName;
        this.orgList.push({
          id: this.$route.params.orgId,
          orgName: this.$route.params.orgName,
        });
      }
      if (this.$route.params.buildingId) {
        this.searchForm.buildingId = this.$route.params.buildingId;
        this.buildingsName = this.$route.params.buildingName;
        this.buildings.push({
          id: this.$route.params.buildingId,
          name: this.$route.params.buildingName,
        });
      }
      this.searchForm.orgId =
        this.$route.params.orgId == 1 ? "" : this.$route.params.orgId;
      await this.Product(); //产品列表
      await this.getDataList(); // 获取设备列表
    }
    // await this.getProductList()
    // this.searchForm.productId = this.$route.params.id
    //   ? this.$route.params.id
    //   : "";
  },
};
</script>

<style scoped lang="less">
@import url("~@views/style/tablePage.less");
@import url("~@views/style/tree.less"); //左侧组织机构样式

.common-container {
  box-shadow: none;
}

::v-deep .el_button.el-button--small {
  background: #7367f0;
  color: #fff;
  border: none;
}

// 下拉框加载开始
.div_box {
  height: 276px;
  position: absolute;
  top: -1px;
  left: -1px;
  width: 100%;
  z-index: 9999;
  // background: red;
  // opacity: 0.5;
}

::v-deep .el-loading-mask {
  border-radius: 4px;
}

// 下拉框加载结束

.header_right {
  display: flex;
  align-items: center;

  .div_qiehuan {
    display: flex;
    align-items: center;
    // color: @primaryScrollWarnName;
    color: #9d9d9d;
    background: @primaryBac;
    height: 35px;
    border-radius: 5px;
    padding: 5px 6px;
    box-sizing: border-box;
    font-size: 14px;

    > div {
      padding: 3px 16px;
      // border: 1px solid #7367F0;
      border-radius: 4px;
      cursor: pointer;
      display: flex;
      align-items: center;

      span {
        margin-left: 5px;
      }
    }

    .kapian {
      margin-right: 5px;
    }
  }
}

// 高级搜索
::v-deep .el-button--primary {
  background-color: #7367f0;
  border: 1px solid #7367f0;
  color: #fff;
}

::v-deep .popover_from .el-form-item__label {
  color: @primaryThemeTxtColor2;
  padding: 0px;
}

::v-deep .el-input__inner {
  color: var(--primaryContentTxt, #f1f1f1) !important;
}

::v-deep .el-button--small {
  border: none;
}

// 日期控件颜色
::v-deep .el-range-editor .el-range-input {
  background: @primaryHeaderBgcolor !important;
  color: @primaryContentTxt;
}

// 日期控件
.el-range-editor.el-input__inner {
  margin-left: 15px;
}

/* 定义滚动条样式 */
::v-deep .el-table__body-wrapper::-webkit-scrollbar {
  display: block; //显示滚动条
  width: 0px; //定义滚动条宽度
  height: 10px; //定义滚动条高度
  border-radius: 10px; //定义滚动条圆角
}

/*定义滚动条轨道 内阴影+圆角*/
::v-deep .el-table__body-wrapper::-webkit-scrollbar-track {
  box-shadow: inset 0 0 0px rgba(240, 240, 240, 0.5); //定义轨道阴影
  border-radius: 10px; //定义轨道圆角
  background-color: transparent; //定义轨道颜色
}

/*定义滑块 内阴影+圆角*/
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
  border-radius: 10px; //定义滑块圆角
  box-shadow: inset 0 0 0px rgba(240, 240, 240, 0.5); //定义滑块阴影
  background-color: @primaryBgcolor12; //定义滑块颜色
}

// 解决el-table固定列滚动错位问题
::v-deep
  .el-table
  .el-table__fixed-right
  .el-table__fixed-body-wrapper
  .el-table__body {
  padding-bottom: 10px !important;
}

// 解决el-table固定列挡住滚动条问题
::v-deep .el-table__fixed-right {
  height: auto !important;
  bottom: 10px !important; // 这个得自己调试看多少合适
}

// 去掉固定列下方的横线， 样式优化
::v-deep .el-table__fixed-right::before {
  display: none !important;
}

// 解决element-ui 中 table 鼠标悬停时高亮背景颜色的修改，添加fixed后颜色又出现问题  ,鼠标滑过td上作用的样式
::v-deep .el-table tbody tr:hover > td {
  background-color: transparent !important;
}

// 解决element-ui 中 table 鼠标悬停时高亮背景颜色的修改，添加fixed后颜色又出现问题
::v-deep .el-table__body .el-table__row.hover-row td {
  background-color: transparent !important;
}

//右边固定
// 解决element-ui 中 table 鼠标悬停时高亮背景颜色的修改，添加fixed后颜色又出现问题
::v-deep .el-table__fixed-right tbody tr:hover > td {
  background-color: transparent !important;
}
</style>
